package JavaLearn08;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main7 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Queue<Integer> arrAQueue = new LinkedList<>();
		Queue<Integer> arrBQueue = new LinkedList<>();

		String[] strs = sc.nextLine().split(" ");

		if (Integer.parseInt(strs[0]) <= 1000) {
			for (int i = 1; i < strs.length; i++) {
				int temp1 = Integer.parseInt(strs[i]);

				if (temp1 % 2 == 0) {
					arrBQueue.add(temp1);
				} else {

					arrAQueue.add(temp1);

				}

			}

		}

		
		
		int i=0;
		
		if(!arrAQueue.isEmpty())
			System.out.print(arrAQueue.poll());
		else {
			System.out.print(arrBQueue.poll());
		}
		
		while(!arrAQueue.isEmpty()||!arrBQueue.isEmpty()) {
			i++;
			if(i%2==0) {
				if(!arrAQueue.isEmpty())
					System.out.print(" "+arrAQueue.poll());
			}else {
				if(!arrAQueue.isEmpty())
					System.out.print(" "+arrAQueue.poll());
				if(!arrBQueue.isEmpty())
					System.out.print(" "+arrBQueue.poll());
				
			}
		}

		

	}

}
